package com.example.demo.Security;

import com.example.demo.Dao.PersonRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * CustomUserDeatailImpl
 *
 * @blame Android Team
 */
@Component
public class CustomUserDeatailImpl  implements UserDetailsService {
    @Resource
    PersonRepository personRepository;
    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
       return   personRepository.findByUsername(s);
    }
}
